package cn.iocoder.yudao.module.dine.print.api;

import cn.hutool.core.collection.CollUtil;
import cn.iocoder.yudao.module.api.dine.DinePrintApi;
import cn.iocoder.yudao.module.dine.print.pojo.po.DinePrintRecord;
import cn.iocoder.yudao.module.dine.print.service.core.CoreDinePrintRecordService;
import jakarta.annotation.Resource;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;
import java.util.Set;

import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertMap;

/**
 * <pre>
 * OOoO0OOoO0OOOooo0oOOOO0OOOOO0oooOO0ooOOO0Ooooo0OOOOo0ooooO0OOooo0Ooooo0OOOOO
 *  这里是文件说明
 * OOoO0OOoO0OOOooo0oOOOO0OOOOO0oooOO0ooOOO0Ooooo0OOOOo0ooooO0OOooo0Ooooo0OOOOO
 * </pre>
 *
 * @author 山野羡民（1032694760@qq.com）
 * @since 2025/08/28
 */
@Service
public class DinePrintApiImpl implements DinePrintApi {
    @Resource
    private CoreDinePrintRecordService coreDinePrintRecordService;

    @Override
    public Map<String, Boolean> getPrintSuccessMap(Set<String> tradeNos) {
        List<DinePrintRecord> list = coreDinePrintRecordService.getListByTradeNos(tradeNos);
        if (CollUtil.isEmpty(list)) {
            return Map.of();
        }
        return convertMap(list, DinePrintRecord::getTradeNo, DinePrintRecord::getSuccess);
    }

}
